Skip to content

Conversation

@cyyynthia
Copy link
Collaborator

@cyyynthia cyyynthia commented Apr 10, 2025

See #3033

Summary by CodeRabbit

  • Chores
    • Upgraded PostgreSQL used across deployment and local Docker images to 16.8 for consistent runtime.
    • Updated the dev/test container runner to use a newer PostgreSQL image variant (PG18) for compatibility testing.
    • Release pipeline now builds additional Docker image tags (including -pg18 variants) to publish artifacts for both standard and PG18 builds.

@cyyynthia cyyynthia added the enhancement New feature or request label Apr 10, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 10, 2025

Walkthrough

PostgreSQL image versions were updated across Docker configs and tooling: several services and the Dockerfile moved to postgres:16.8; the Gradle task uses postgres:16.8; one Kotlin test runner now references postgres:18.0; GitHub workflow adds legacy Dockerfile usage and -pg18 image tags. No public API changes.

Changes

Cohort / File(s) Change Summary
Kotlin runner
backend/app/src/main/kotlin/io/tolgee/postgresRunners/PostgresDockerRunner.kt
Updated Docker image used by test runner: postgres:16.3postgres:18.0.
Gradle task
build.gradle
Updated startDbChangelogContainer task to use postgres:16.8 (was postgres:13).
App Dockerfile
docker/app/Dockerfile
Base image changed from postgres:13.20-alpine3.21postgres:16.8; package manager workflow changed from apk to apt and now installs temurin-21-jdk and libxml2.
Compose templates
docker/docker-compose.template.yml, docker/docker-compose.yml
db service image updated: postgres:11postgres:16.8.
CI workflow
.github/workflows/release.yml
Docker build steps now use -f legacy.Dockerfile and add image tags including -pg18 variants.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–30 minutes

  • Pay attention to:
    • Compatibility implications of changing the test runner to postgres:18.0 while other artifacts use postgres:16.8.
    • Dockerfile migration from Alpine (apk) to Debian-style (apt) and the correctness of Adoptium repository setup and package cleanup.
    • CI changes adding -pg18 tags and use of legacy.Dockerfile.

Possibly related PRs

Suggested reviewers

  • JanCizmar

Poem

I'm a rabbit in a code-filled glade, 🐇
I hop on tags the devs have laid.
Postgres versions leap and twine,
From eleven, thirteen, sixteen — now near eighteen’s line.
I nibble bytes and cheer this upgrade divine.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ⚠️ Warning The title claims 'postgres to 18' but the changes actually update to version 16.8, creating a discrepancy between the title and actual implementation. Update the title to accurately reflect that PostgreSQL is being updated to version 16.8, not 18. For example: 'feat: update postgres to 16.8 Debian-based and release *-pg16 Docker builds'
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cynthia/update-postgres

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cyyynthia
Copy link
Collaborator Author

Well well well, after a bit of digging, it seems like that PR accidentally found some bugs... 🙃

There was issues with sorting because using Alpine (like in the distributed image..!) means using musl libc, which has very limited support for fancy locales stuff and was only doing bytewise comparisons.

Thankfully, since PostgreSQL 15 we can rely on ICU instead, which appears to solve the issues. Tests still fail, but after glancing at the results it seems the tests are the problem this time, but I didn't investigate further.

@cyyynthia cyyynthia force-pushed the cynthia/update-postgres branch 2 times, most recently from 724ebc1 to befd300 Compare April 10, 2025 22:04
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
backend/misc/src/main/kotlin/io/tolgee/misc/dockerRunner/DockerContainerRunner.kt (1)

129-135: Improved command string processing to handle escaped spaces correctly.

The updated implementation uses a more sophisticated regex pattern with a negative lookbehind assertion ((?<!\\)\\s+) to ensure that escaped spaces in command arguments are preserved during splitting. This is followed by a mapping operation that converts these escaped spaces to regular spaces.

This enhancement is important for correctly processing Docker commands that might include arguments with spaces, such as container names or paths with spaces, which need to be escaped in the command line.

Consider adding a brief comment explaining the purpose of this regex and transformation for future maintainability:

  private fun String.startProcess(
    workingDir: File,
    timeoutAmount: Long,
    timeoutUnit: TimeUnit,
  ): Process {
+   // Split command by whitespace but preserve escaped spaces, then convert escaped spaces to regular spaces
    val transformed = "(?<!\\\\)\\s+"
      .toRegex()
      .split(this.trim())
      .map { it.replace("\\ ", " ") }

    return ProcessBuilder(transformed)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8f34749 and befd300.

📒 Files selected for processing (6)
  • backend/app/src/main/kotlin/io/tolgee/postgresRunners/PostgresDockerRunner.kt (2 hunks)
  • backend/misc/src/main/kotlin/io/tolgee/misc/dockerRunner/DockerContainerRunner.kt (1 hunks)
  • build.gradle (1 hunks)
  • docker/app/Dockerfile (1 hunks)
  • docker/docker-compose.template.yml (1 hunks)
  • docker/docker-compose.yml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • backend/app/src/main/kotlin/io/tolgee/postgresRunners/PostgresDockerRunner.kt
  • build.gradle
  • docker/app/Dockerfile
  • docker/docker-compose.template.yml
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build backend 🏗️
🔇 Additional comments (3)
docker/docker-compose.yml (3)

3-3: Update DB Service Image Version

The db service now uses postgres:16.8-alpine3.21, which aligns with the PR objective to update PostgreSQL image references. This change is properly applied.


7-8: Introduce POSTGRES_INITDB_ARGS for ICU Locale Support

Adding the POSTGRES_INITDB_ARGS environment variable with the arguments --locale-provider=icu --icu-locale=und-u-kn-true is a critical enhancement. This change leverages ICU for proper locale handling and better sorting behavior. Please ensure that the initialization arguments are tested in your test environment so that they produce the expected locale settings.


19-19: Clarify SMTP Service Image Change

The SMTP service image on line 19 is updated to namshi/smtp. Since the primary PR objective focuses on updating PostgreSQL image references, please confirm whether this change was intentional. If it is part of a broader update, it would be helpful to include additional context in the PR description.

@cyyynthia cyyynthia force-pushed the cynthia/update-postgres branch from befd300 to 92bb8f9 Compare April 11, 2025 07:47
@cyyynthia
Copy link
Collaborator Author

Well, given the amount of issues surfaced by trying Alpine images, I think it's best for now to stick to Debian-based images, and experiment with Alpine images more thoroughly later.

I am unsure if the configuration I tried to use with Alpine (--locale-provider=icu --icu-locale=und-u-kn-true) yielded the expected behavior, but I can definitely say that this config was making sort operations behave using natural string ordering (1, 2, 10 instead of 1, 10, 2). Whether the remaining issues were from the sort behavior exhibited by PostgreSQL or the tests being incorrect is unclear.

@cyyynthia cyyynthia changed the title feat: update all postgres image references to 16.8-alpine3.21 feat: update all postgres image references to 16.8 Debian-based Apr 11, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
docker/app/Dockerfile (1)

5-10: APT Installation and Cleanup Block

The heredoc RUN block correctly:

  • Enables strict mode with set -eux
  • Updates the apt cache quietly
  • Installs temurin-21-jdk and libxml2 in a single layer
  • Cleans up the apt lists to reduce image size

As an optional improvement, consider setting the environment variable DEBIAN_FRONTEND=noninteractive to suppress any interactive prompts during package installation. Here’s a diff suggestion:

-FROM postgres:16.8
+FROM postgres:16.8
+ENV DEBIAN_FRONTEND=noninteractive

This change can help ensure that the build stays non-interactive even if future package changes introduce prompts.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 92bb8f9 and 8ba3cfd.

📒 Files selected for processing (1)
  • docker/app/Dockerfile (1 hunks)
🔇 Additional comments (1)
docker/app/Dockerfile (1)

1-1: Base Image Update Verification

The base image has been updated to postgres:16.8, consistent with the PR objective to move to a Debian-based PostgreSQL image. Please verify that the default variant for postgres:16.8 is indeed Debian-based as expected.

@cyyynthia cyyynthia force-pushed the cynthia/update-postgres branch 2 times, most recently from 182b46a to ac497e9 Compare April 11, 2025 08:55
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
docker/app/Dockerfile (1)

5-15: Streamlined RUN Block with Apt Commands

The multi-line RUN block is well-structured. It updates the package lists, installs wget to fetch the Adoptium GPG key, configures the Adoptium repository, installs temurin-21-jdk and libxml2, and then cleans up by removing wget and clearing cached package lists. This helps keep the Docker image size lean.

One optional enhancement is to ensure noninteractive installation by setting the DEBIAN_FRONTEND environment variable. This can help prevent any unforeseen interactive prompts during package installation. You can either add it as a global environment variable or prepend it to the RUN command. For instance:

+ENV DEBIAN_FRONTEND=noninteractive

Or modify the RUN command as follows:

-RUN <<EOF
+RUN export DEBIAN_FRONTEND=noninteractive && <<EOF

This change is optional but can improve reliability in automated builds.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 182b46a and ac497e9.

📒 Files selected for processing (1)
  • docker/app/Dockerfile (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Frontend static check 🪲
  • GitHub Check: Build backend 🏗️
  • GitHub Check: Build frontend 🏗️
🔇 Additional comments (1)
docker/app/Dockerfile (1)

1-1: Base Image Update Verification

The base image has been correctly updated to postgres:16.8, which aligns with the PR objective of moving to a Debian-based image with the latest PostgreSQL version. Please confirm that all dependent tools and configurations in the project are compatible with this image.

@JanCizmar
Copy link
Contributor

Thanks a lot for the PR anyway! ❤️ Btw. What prevent us from upgrading to Postgres 17?

@cyyynthia
Copy link
Collaborator Author

What prevent us from upgrading to Postgres 17?

Probably nothing tbh. I just stayed on 16 since that's what was used in all the tests 😅

@dzienisz
Copy link
Contributor

dzienisz commented Sep 9, 2025

any update on that?

@JanCizmar
Copy link
Contributor

We currently cannot proceed with this, because there are many users with embedded Postgres. We might consider sunset the embedded Postgres and introduce new major version with breaking change, letting the users migrate themselves for example.

Still we might need some migration guide.

@cyyynthia cyyynthia force-pushed the cynthia/update-postgres branch from ac497e9 to fabd161 Compare November 6, 2025 21:03
@cyyynthia
Copy link
Collaborator Author

Having this upgrade stuck bothered me, so I'm proposing an alternative approach: keep the existing releases on pg13 but start building -pg18 images that ship with the freshly released PostgreSQL 18.

Hopefully this will unblock this situation which is starting to become quite critical with PostgreSQL 13's EOL.

@cyyynthia cyyynthia requested a review from JanCizmar November 6, 2025 21:06
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ac497e9 and fabd161.

📒 Files selected for processing (2)
  • .github/workflows/release.yml (1 hunks)
  • backend/app/src/main/kotlin/io/tolgee/postgresRunners/PostgresDockerRunner.kt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • backend/app/src/main/kotlin/io/tolgee/postgresRunners/PostgresDockerRunner.kt
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: laz-001
Repo: tolgee/tolgee-platform PR: 0
File: :0-0
Timestamp: 2025-05-09T01:35:14.224Z
Learning: Changes to PostgreSQL container names, ports, Liquibase changelog paths, and test data directories in the Tolgee platform are often made to provide dedicated resources to parallel test groups (like `ee-test:test` and `server-app:test`), preventing resource congestion and collisions that could lead to deadlocks during testing.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: BT ‍🔎 (server-app:runWithoutEeTests)
  • GitHub Check: BT ‍🔎 (ktlint:test)
  • GitHub Check: BT ‍🔎 (data:test)
  • GitHub Check: BT ‍🔎 (security:test)
  • GitHub Check: BT ‍🔎 (ee-test:test)
  • GitHub Check: BT ‍🔎 (server-app:runStandardTests)
  • GitHub Check: BT ‍🔎 (server-app:runContextRecreatingTests)
  • GitHub Check: BT ‍🔎 (server-app:runWebsocketTests)
  • GitHub Check: Frontend static check 🪲
  • GitHub Check: Build frontend 🏗️

@cyyynthia cyyynthia changed the title feat: update all postgres image references to 16.8 Debian-based feat: update postgres to 18 Debian-based and release *-pg18 Docker builds Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants